package com.ass.rocketmq.base;

import lombok.extern.log4j.Log4j2;
import org.apache.rocketmq.client.producer.MessageQueueSelector;
import org.apache.rocketmq.common.message.Message;
import org.apache.rocketmq.common.message.MessageQueue;

import java.util.List;

@Log4j2
//生产者队列选择器 用于实现顺序生产者
public abstract class AbstractMessageQueueSelector implements MessageQueueSelector {


    protected abstract QueueSelectorFunction<List<MessageQueue>,Message,Object,MessageQueue> doQueueSelector();




    @Override
    public MessageQueue select(List<MessageQueue> mqs, Message msg, Object arg) {
        return doQueueSelector().apply(mqs,msg,arg);
    }
}
